/*
 *  @ProductName@
 *  Copyright (C) @CopyrightYear@
 *    National Institute of Advanced Industrial Science and Technology (AIST)
 *    Registration Number: @AISTRegistrationNumber@
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package jp.go.aist.six.vuln.model.scap.vulnerability;

import java.io.Serializable;
import java.util.HashMap;




/**
 *
 * @author	Akihito Nakamura, AIST
 * @version $Id: VulnerabilityReferenceCategory.java 5 2010-05-15 09:58:30Z nakamura5akihito $
 */
public final class VulnerabilityReferenceCategory
    implements Serializable
{

    private static final String  _PATCH_                           = "PATCH";
    private static final String  _VENDOR_ADVISORY_                 = "VENDOR_ADVISORY";
    private static final String  _THIRD_PARTY_ADVISORY_            = "THIRD_PARTY_ADVISORY";
    private static final String  _SIGNATURE_SOURCE_                = "SIGNATURE_SOURCE";
    private static final String  _MITIGATION_PROCEDURE_            = "MITIGATION_PROCEDURE";
    private static final String  _TOOL_CONFIGURATION_DESCRIPTION_  = "TOOL_CONFIGURATION_DESCRIPTION";
    private static final String  _UNKNOWN_                         = "UNKNOWN";


    public static final VulnerabilityReferenceCategory  PATCH                           = new VulnerabilityReferenceCategory( _PATCH_ );
    public static final VulnerabilityReferenceCategory  VENDOR_ADVISORY                 = new VulnerabilityReferenceCategory( _VENDOR_ADVISORY_ );
    public static final VulnerabilityReferenceCategory  THIRD_PARTY_ADVISORY            = new VulnerabilityReferenceCategory( _THIRD_PARTY_ADVISORY_ );
    public static final VulnerabilityReferenceCategory  SIGNATURE_SOURCE                = new VulnerabilityReferenceCategory( _SIGNATURE_SOURCE_ );
    public static final VulnerabilityReferenceCategory  MITIGATION_PROCEDURE            = new VulnerabilityReferenceCategory( _MITIGATION_PROCEDURE_ );
    public static final VulnerabilityReferenceCategory  TOOL_CONFIGURATION_DESCRIPTION  = new VulnerabilityReferenceCategory( _TOOL_CONFIGURATION_DESCRIPTION_ );
    public static final VulnerabilityReferenceCategory  UNKNOWN                         = new VulnerabilityReferenceCategory( _UNKNOWN_ );



    private static HashMap<String, VulnerabilityReferenceCategory> _INIT_()
    {
        HashMap<String, VulnerabilityReferenceCategory>  map = new HashMap<String, VulnerabilityReferenceCategory>();
        map.put( _PATCH_,                           PATCH  );
        map.put( _VENDOR_ADVISORY_,                 VENDOR_ADVISORY   );
        map.put( _THIRD_PARTY_ADVISORY_,            THIRD_PARTY_ADVISORY  );
        map.put( _SIGNATURE_SOURCE_,                SIGNATURE_SOURCE  );
        map.put( _MITIGATION_PROCEDURE_,            MITIGATION_PROCEDURE  );
        map.put( _TOOL_CONFIGURATION_DESCRIPTION_,  TOOL_CONFIGURATION_DESCRIPTION  );
        map.put( _UNKNOWN_,                         UNKNOWN  );
        return map;
    }

    private static final HashMap<String, VulnerabilityReferenceCategory>  _INSTANCES_ = _INIT_();




    /**
     */
    public static VulnerabilityReferenceCategory valueOf(
                    final String name
                    )
    {
        VulnerabilityReferenceCategory  category = null;
        if (name != null) {
            category = _INSTANCES_.get( name );
        }

        if (category == null) {
            throw new IllegalArgumentException( "invalid vulnerability reference category: " + name );
        }

        return category;
    }



    private String  _name = null;



    /**
     */
    private VulnerabilityReferenceCategory(
                    final String name
                    )
    {
        _name = name;
    }



    /**
     */
    public String getName()
    {
        return _name;
    }



    //**************************************************************
    //  java.lang.Object
    //**************************************************************

    @Override
    public String toString()
    {
        return getName();
    }

}
// VulnerabilityReferenceCategory
